import Vue from 'vue'
import App from './App.vue'
import router from './router'
// import './plugins/element.js'
// import './assets/fonts/iconfont.css'
import './assets/css/global.css'
import axios from 'axios'
import ZkTable from 'vue-table-with-tree-grid'
import VueQuillEditor from 'vue-quill-editor'

import Nprogress from 'nprogress'

Vue.use(VueQuillEditor, /* { default global options } */)
// Vue.use(Nprogress)

// 配置请求的跟路径
// axios.defaults.baseURL = 'http://127.0.0.1:4444/api/private/v1/'
axios.defaults.baseURL = '/api/private/v1'
axios.interceptors.request.use(config => {
  // NProgress.start();
  // console.log(config)
  config.headers.Authorization = window.sessionStorage.getItem('token')
  // 在最后必须 return config
  return config
})
axios.interceptors.response.use(config => {
  // NProgress.done();
  return config
})

Vue.prototype.$http = axios
Vue.config.productionTip = false
Vue.component('tree-table', ZkTable)


Vue.filter('dataFormat',(originDate)=>{
  const data = new Date(originDate);

  const y = data.getFullYear();
  const m = (data.getMonth() + 1 + '').padStart(2,'0');
  const d = (data.getDay() + 1 + '').padStart(2,'0');
  
  const hh = (data.getHours() + 1 + '').padStart(2,'0');
  const mm = (data.getMinutes() + 1 + '').padStart(2,'0');
  const ss = (data.getSeconds() + 1 + '').padStart(2,'0');

  return `${y}-${m}-${d} ${hh}:${mm}:${ss}`;

})

new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
